package com.fanqwz.hexieshe;

import android.support.annotation.NonNull;

import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

import javax.inject.Inject;
import javax.inject.Singleton;

/**
 * Created by fanqw on 2017/6/30.
 */

@Singleton
public class JobExecutor implements Executor {
    private final ThreadPoolExecutor executor;

    @Inject
    public JobExecutor() {
        executor = new ThreadPoolExecutor(5, 10, 20, TimeUnit.SECONDS,
                new LinkedBlockingQueue<>());
    }

    @Override
    public void execute(@NonNull Runnable command) {
        executor.execute(command);
    }
}
